package com.example.server.service;

import com.example.server.entity.User;
import com.example.server.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    public List<User> findAll()
    {
       return userMapper.findAll();
    }
    public List<User> findByName(String username){
        return userMapper.findByName(username);
    }
    public Integer delete(@PathVariable Integer id)
    {
        return userMapper.deleteById(id);
    }
    public Integer save(User user)
    {
        return userMapper.save(user);
    }
}
